#coding=utf-8
__author__ = 'TANUKI'

import pytest
import allure
import time, re, os, sys
from appium import webdriver
sys.path.append(".")


sys.path.append("../ReleasePage")
# from 文件名 import Class名
from Case003_iOSWalletPage import iOSWalletPage
#from public import *


class Test_Roxe_WalletPage():
    def setup_method(self):
        desired_caps = {
            'platformName': 'iOS',
            'deviceName': 'roxe',
            'platformVersion': "13.6.1",
            'udid': '6d467187ae9bcdad437fe146061130280f559764',
            'bundleId': 'com.roxe.app',
            'automationName': 'XCUITest',
            #'noReset': True,
            #'noSign': True,
        }
        self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
        time.sleep(5)

    def teardown_method(self):
        time.sleep(3)
        #Driver.driver.quit()


    @pytest.mark.skip(reason="写脚本的时候跳过")
    @allure.feature('用例名称:Wallet页面测试')
    def test_ROXEiOS_004WalletPage(self):
        driver = self.driver
        TestResult = iOSWalletPage.IntoWallet(driver)

        assert TestResult == True


    @pytest.mark.skip(reason="写脚本的时候跳过")
    @allure.feature('用例名称:使用Debit Card给账户充值')
    def test_ROXEiOS_005DebitCardadd(self):
        driver = self.driver
        TestResult = iOSWalletPage.DebitCardAdd(driver)

        assert TestResult == True

    @pytest.mark.skip(reason="写脚本的时候跳过")
    @allure.feature('用例名称:绑定BankAccount卡')
    def test_ROXEiOS_006BankAccountAdd(self):
        driver = self.driver
        TestResult = iOSWalletPage.BankAccountAdd(driver)

        assert TestResult == True

    #@pytest.mark.skip(reason="写脚本的时候跳过")
    @allure.feature('用例名称:使用BankAccount给账户充值')
    def test_ROXEiOS_007BankAccountTopUp(self):
        driver = self.driver
        TestResult = iOSWalletPage.BankAccountTopUp(driver)

        assert TestResult == True

if __name__ == "__main__":
    ENV = 2
    #print (ENV)
    if int(ENV) == 1:
        pytest.main()
    elif int(ENV)== 2:
        pytest.main(['start_003_WalletPage.py', "-s", "-v"])
        #pytest.main(['start_001_iOSLogin.py', 'start_002_iOSDealADay.py', 'start_003_WalletPage.py', "-s", "-v"])
        #pytest.main(['start_001_iOSLogin.py','start_002_iOSDealADay.py','start_003_WalletPage.py', "-s", "-v", "--alluredir", "./Report"])
        #os.system("allure generate ./Report -o ./Report/html/")
        #os.system('allure serve ./Report')
